﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DevExpress.Web.ASPxGridView;
using SGRapidForm.Permission.Service.Interface;
using SGRapidForm.Common;

namespace SGDemo.Permission
{
    public partial class SelectHelpPopup : System.Web.UI.Page
    {
        IPermissionService _permissionService = ServiceProxyFactory.Create<IPermissionService>("permissionservice");
        protected void Page_Load(object sender, EventArgs e)
        {
            this.gvwList.SettingsBehavior.AllowSelectSingleRowOnly = (this.Request.QueryString["SelectionMode"] == "Single");
            BindHelpMethod();
        }
        //绑定帮助类别也方法
        protected void BindHelpMethod()
        {
           cbHelpCategoryKeyid.DataSource= _permissionService.HelpCategory_GetAll();
           cbHelpCategoryKeyid.TextField = "HelpCategoryName";
           cbHelpCategoryKeyid.ValueField = "Keyid";
           cbHelpCategoryKeyid.DataBind();
        }
        /// <summary>
        /// 自定义GridView回调重新绑定
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void gvwList_CustomCallback(object sender, ASPxGridViewCustomCallbackEventArgs e)
        {
            gvwList.PageIndex = 0;
            gvwList.DataBind();
        }
    }

    public class HelpDataSource
    {
        private IPermissionService _permissionService = ServiceProxyFactory.Create<IPermissionService>("permissionservice");

        public List<SGRapidForm.Permission.Entity.Help> FilteredGetAll(string filterConditions)
        {
            return _permissionService.Help_FilteredGetAll(filterConditions);
        }

    }
}